#!/bin/bash

if [ $# -ne 2 ]; then
    echo "error"
    exit 1
fi

N=$1
M=$2

generate_class(){
    echo "class$(($RANDOM % N + 1))"
}

generate_score(){
    echo $(($RANDOM % 100))
}

> scores.txt

for ((i=1; i<=M; i++)); do
    student="student$i"
    class=$(generate_class)
    score=$(generate_score)
    echo "$student:$class:$score" >> scores.txt
done

echo "Generated scores for $N classes with $M students each."


